extends layout

block content
    script(type='text/javascript', src='./javascripts/timeout.js')
    script(type='text/javascript', src='./javascripts/jquery-1.10.2.min.js')
    script(type='text/javascript', src='./javascripts/admin.js')
    script(type='text/javascript', src='./javascripts/user-main.js')
    script(type='text/javascript', src='./javascripts/gameboard.js')
    #mainContentPain
        #banner
            img(src='./images/battleship.jpg')
        include userbar

        #spectatorView
            table
                tbody
                    tr
                        td
                            h1.player1 Player One
                        td
                        td
                            h1.player2 Player Two
                    tr
                        td.gameboardTD
                            #gameboard-p1
                                include gameboard

                        td.divider

                        td.gameboardTD
                            #gameboard-p2
                                include gameboard


        #display
            include message
            hr

            form(method="post")

                input(type="submit", name="postCommand", value="My details")

            form(method="post")

                input(type="submit", value="Edit My Details", name="postCommand")
                input(type="button", name="postCommand", value="Hide my details",onclick="location=href='/users'")

                label.formlabel username:
                input(type="text", name="userName", class="formInput")

                label.formlabel password:
                input(type="password", name="password", class="formInput", required)

                label.formlabel email:
                input(type="email", name="email", class="formInput", required)
                br
                hr

            #usersTable

                - for (var id in database) {
                    - var name = database[id].userName
                    - var password = database[id].password
                    - var email = database[id].email
                    - var joinDate = database[id].joinDate
                    - var isLoggedIn = database[id].isOnline
                    - var isAdmin = database[id].isAdmin

                        table
                            tbody
                                tr
                                    td
                                        label User Name:
                                    td.tableUsername #{name}
                                tr
                                    td
                                        label Password:
                                    td #{password}
                                tr
                                    td
                                        label Email:
                                    td #{email}
                                tr
                                    td
                                        label Login Status:
                                    td
                                        | Online
                                tr
                                    td
                                        label Administrator:
                                    td
                                        if isAdmin
                                            | True
                                        else
                                            | False
                                tr
                                    td
                                        label Join date:
                                    td #{joinDate}
                    - }

        include footer
        hr